﻿@using System.Collections.Generic
@using System.Collections.ObjectModel
@using System.Web.Http.Description
@using System.Threading
@using epalpay.api.help.ModelDescriptions
@model IList<ApiParameterDescription>
@{IDictionary<Type, string> DefaultTypeDocumentation = new Dictionary<Type, string>
        {
            { typeof(Int16), "integer" },
            { typeof(Int32), "integer" },
            { typeof(Int64), "integer" },
            { typeof(UInt16), "unsigned integer" },
            { typeof(UInt32), "unsigned integer" },
            { typeof(UInt64), "unsigned integer" },
            { typeof(Byte), "byte" },
            { typeof(Char), "character" },
            { typeof(SByte), "signed byte" },
            { typeof(Uri), "URI" },
            { typeof(Single), "decimal number" },
            { typeof(Double), "decimal number" },
            { typeof(Decimal), "decimal number" },
            { typeof(String), "string" },
            { typeof(Guid), "globally unique identifier" },
            { typeof(TimeSpan), "time interval" },
            { typeof(DateTime), "date" },
            { typeof(DateTimeOffset), "date" },
            { typeof(Boolean), "boolean" },
        };}
@if (Model.Count > 0)
{
    <table class="help-page-table">
        <thead>
            <tr><th>Name</th><th>Description</th><th>Type</th><th>Additional information</th></tr>
        </thead>
        <tbody>
            @foreach (ApiParameterDescription parameter in Model)
            {
                //ModelDescription modelDescription = parameter.TypeDescription;
                <tr>
                    <td class="parameter-name">@parameter.Name</td>
                    <td class="parameter-documentation">
                        <p>@Html.Raw(parameter.Documentation != null ? parameter.Documentation.Replace("\r\n", "<br/>") : "")</p>
                    </td>
                    <td class="parameter-type">
                        @{string typeName = string.Empty;
                            DefaultTypeDocumentation.TryGetValue(parameter.ParameterDescriptor.ParameterType, out typeName); if (typeName == string.Empty)
                            { typeName = parameter.ParameterDescriptor.ParameterType.Name; }
                        }
                        @typeName
                    </td>
                    <td class="parameter-annotations">
                        <p>None.</p>
                    </td>
                </tr>
            }
        </tbody>
    </table>
}
else
{
    <p>None.</p>
}

